local zhuhong = fk.CreateSkill {
  name = "kq__zhuhong",
}
Fk:loadTranslationTable{
  ["kq__zhuhong"] = "筑洪",
  [":kq__zhuhong"] = "出牌阶段限一次，你可以令所有角色各重铸你指定的一种类型的所有牌，你对因此重铸牌数最多的角色各造成1点雷电伤害，然后若你因此受到伤害，你摸你本次因此重铸的牌数张牌。",
  ["#kq__zhuhong-choice"] = "所有角色依次重铸你指定类型的所有牌",
  ["#@@kq__zhuhong-turn"] = "筑洪 重铸 "
}


zhuhong:addEffect("active", {
  anim_type = "offensive",
  card_num = 0,
  target_num = 0,
  can_use = function(self, player)
    return player:usedSkillTimes(zhuhong.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  prompt = "#kq__zhuhong-choice",
  on_use = function(self, room, effect)
    local player = effect.from
    local choice = room:askToChoice(player, {
      choices = {"basic", "equip", "trick"},
      skill_name = zhuhong.name
    })
    local mc = 0
    for _, p in ipairs(room:getAlivePlayers()) do
        local cards = table.filter(p:getCardIds("he"), function (id) return Fk:getCardById(id):getTypeString() == choice end)
        room:addPlayerMark(p, "#@@kq__zhuhong-turn",#cards)
        if #cards>mc then
          mc=#cards
        end
        room:recastCard(cards, p, zhuhong.name)
        room:delay(300)
    end
    for _, p in ipairs(room:getAlivePlayers()) do
        local num = p:getMark("#@@kq__zhuhong-turn")
        if num == mc then
          room:damage{
           from = player,
           to = p,
           damage = 1,
           skillName = zhuhong.name,
           damageType = fk.ThunderDamage
          }
        end
        if p == player and num == mc then
          player:drawCards(num,zhuhong.name)
        end
        room:setPlayerMark(p, "#@@kq__zhuhong-turn", 0)
    end
  end,
})

return zhuhong
